<template>
  <div>
    <h1>我是小组件{{ value }}</h1>
    <button @click="fn">+1</button>
  </div>
</template>

<script>
export default {
  props: {
    value: {
      type: Number,
      required: true,
    },
  },
  data() {
    return {
      msg: "我是组件上的 数据",
    };
  },
  methods: {
    fn() {
      this.$emit("input", this.value + 1);
    },
    fn2(){
        console.log('我是组件上的函数');
    }
  },
};
</script>

<style>
button {
  font-size: 20px;
  font-weight: 700;
}
</style>